{% load i18n %}
{% load core_tags %}
{% load privacy_tags %}
{% load gravatar %}
{% load projects_tags %}

{% block repo %}
  {% if project.repo %}
    <h3>{% trans "Repository" %}</h3>
    <p class="detail-long">{{ project.repo|urlize }}</p>
  {% endif %}
{% endblock %}

{% block last-built %}
  <h3>{% trans "Last Built" %}</h3>
  <p>
    {% with build=project.get_latest_build %}
      {% if build %}
          {% if build.date %}
            {{ build.date|timesince }} ago
            {% if build.success %}
              <span class="build-state build-state-passing">{% trans "passed" %}</span>
            {% else %}
              <span class="build-state build-state-failing">{% trans "failed" %}</span>
            {% endif %}
          {% else %}
            Currently Building
          {% endif %}
      {% else %}
        No builds yet
      {% endif %}
    {% endwith %}
  </p>
{% endblock %}

{% block owners %}
    <h3>{% trans "Owners" %}</h3>
    <p>
      {% for user in project.users.all %}
      <a href="{% url "profiles_profile_detail" user.username %}">{% gravatar user.email 32 %}</a>
      {% endfor %}
    </p>
{% endblock %}

{% block homepage %}
  {% if project.project_url %}
    <h3>{% trans "Home Page" %}</h3>
    <p>
      <a href="{{ project.project_url }}" rel="nofollow,noindex">{{ project.project_url }}</a>
    </p>
  {% endif %}
{% endblock %}

{% block badge %}
    <h3>{% trans "Badge" %}</h3>
      <a href="{{ site_url }}" style="text-decoration: none;" onclick="$('#badge_markup').toggle(); return false;">
        <img src="{{ badge_url }}" />
      </a>
      {% include "core/badge_markup.html" with badge_url=badge_url site_url=site_url %}
{% endblock %}


{% block tags %}
  {% if project.tags.count %}
    <h3>{% trans "Tags" %}</h3>
    <p>
      {% for tag in project.tags.all %}
        <a href="{% url "projects_tag_detail" tag.slug %}">{{ tag.name }}</a>{% if forloop.last %}{% else %}, {% endif %}
      {% empty %}
        <span class="quiet">{% trans "No tags" %}</span>
      {% endfor %}
    </p>
  {% endif %}
{% endblock %}

{% block privacy-level %}
  <h3>{% trans "Project Privacy Level" %}</h3>
  <div id="privacy_level">
    <p>
      {{ project.get_privacy_level_display }}
    </p>
  </div>
{% endblock %}

{% block short-urls %}
  <h3>{% trans "Short URLs" %}</h3>
  <p>
    <a href="http://{{ project.slug}}.{{ PUBLIC_DOMAIN }}">{{ project.slug }}.{{ PUBLIC_DOMAIN }}</a><br>
    {% if PUBLIC_DOMAIN == "readthedocs.io" %}
    <a href="http://{{ project.slug}}.rtfd.io">{{ project.slug }}.rtfd.io</a>
    {% endif %}
  </p>
{% endblock %}

{% block translations %}
  {% if project.translations.exists %}
    <h3>{% trans "Translations" %}</h3>
      <ul>
      {% for trans in project.translations.all %}
          <li><a href="{{ trans.get_docs_url }}">{{ trans.language }}</a></li>
      {% endfor %}
      </ul>
  {% endif %}
{% endblock %}

{% block subprojects %}
  {% if project.subprojects.exists %}
    <h3>{% trans "Sub Projects" %}</h3>
      <ul>
      {% for rel in project.subprojects.all %}
          <li><a href="{{ rel.get_absolute_url }}">{{ rel.child }}</a></li>
      {% endfor %}
      </ul>
  {% endif %}
{% endblock %}

{% block defaults %}
<h3>{% trans "Default Version" %}</h3>
<p> {{ project.get_default_version }}</p>

<h3>{% trans "'latest' Version" %}</h3>
<p> {{ project.get_default_branch }}</p>
{% endblock %}
